﻿using System;
using System.Collections.Generic; 
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class Validations : System.Web.Services.WebService {

 
    RegistrationData regdata = new RegistrationData();
    SqlDataReader dr;

    [WebMethod]
    public string CheckUserName(string UserName)
    {
        dr = regdata.CheckUserName(UserName);
        if (dr.HasRows)
        {
            if (dr.Read())
            {
                if (dr["UserName"] != DBNull.Value)
                {
                    if (dr["UserName"].ToString() == UserName)
                    {
                        dr.Close();
                        return true.ToString();

                    }
                }
            }
        }

        dr.Close();
        return false.ToString();
    }
    [WebMethod]
    public string CheckEmail(string Email)
    {
        dr = regdata.CheckEmail(Email);
        if (dr.HasRows)
        {
            if (dr.Read())
            {
                if (dr["Email"] != DBNull.Value)
                {
                    if (dr["Email"].ToString() == Email)
                    {
                        dr.Close();
                        return true.ToString();

                    }
                }
            }
        }

        dr.Close();
        return false.ToString();
    }

    [WebMethod]
    public bool CheckMobileNo(Int64 MobileNo)
    {
        regdata.MobileNo = MobileNo;
        dr = regdata.CheckMobileNo();
        if (dr.HasRows)
        {
            if (dr.Read())
            {
                if (dr["Mobile"] != DBNull.Value)
                {
                    if (Convert.ToInt64( dr["Mobile"]) == MobileNo)
                    {
                        dr.Close();
                        return true;

                    }
                }
            }
        }

        dr.Close();
        return false;
    } 
}
